home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freaks Macintosh Archive
/
Freaks Macintosh Archive.bin
/
Freaks Macintosh Archives
/
HackAddict™ Magazine
/
HA 1-12
/
HackAddict11.sit
/
HackAddict 11 ƒ
/
Files
/
Seti's UNIX Shell Scripts
/
dec.c
next >
Wrap
C/C++ Source or Header
|
1998-02-14
|
1KB
|
61 lines
/*This program is a simple UNIX password cracker.
It will encrypt every word in a dictionary and compare it
with the encrypted password you entered. The time shown is the time it
took to crack the password.
To compile: gcc dec.c -o dec
-Seti
*/
#include <unistd.h>
#include <stdio.h>
main()
{
char pass[15];
char words[80];
char salt[3];
char dict[50];
char login[15];
char *pw, *pw2;
int i, counter, var;
FILE *fp;
printf("\nEnter the users login: ");
scanf("%s", login);
printf("\nEnter the encrypted password: ");
scanf("%s", pass);
printf("\nEnter the first two characters of the password: ");
scanf("%s", salt);
pw2 = crypt(login, salt);
i = strcmp(pw2, pass);
if (i == 0) {
printf("\nPassword match at users login: %s\n\n", login);
exit(0);
}
printf("\nEnter the full dictionary location: ");
scanf("%s", dict);
printf("\nReading dictionary...\n\n");
if ((fp = fopen(dict, "r")) == NULL) {
printf("\nDictionary file not found\n");
exit(0);
}
system("date +%l:%M:%S");
fp = fopen(dict, "r");
while ((var = fscanf(fp, "%s", words)) != EOF) {
pw2 = crypt(words, salt);
i = strcmp(pw2, pass);
if (i == 0) {
system("date +%l:%M:%S");
printf("\nPassword match at: %s\n\n", words);
fclose(fp);
exit(0);
}
}
fclose(fp);
printf("No password match found for '%s'\n\n", pass);
return 0;
}